package thinkingJava.chapter18;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class StoringAndRecoveringData {
	static String file = "";
	public static void main(String[] args) throws IOException {
//		String filename = BasicFileOutput.chapter18Path + "StoringAndRecoveringData.java";

		DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
			new FileOutputStream("Data.txt")));
		out.writeDouble(3.1415926);
		out.writeUTF("That was pi");
		out.writeDouble(1.41413);
		out.writeUTF("Square root of 2");
		out.close();

		DataInputStream in = new DataInputStream(new BufferedInputStream(
				new FileInputStream("Data.txt")));
		System.out.println(in.readDouble());
		System.out.println(in.readUTF());
		System.out.println(in.readDouble());
		System.out.println(in.readUTF());

	}
}
